/// @tags:
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <tr1/unordered_map>

namespace BlueQuantum {

int const N = 100, base = 19260817;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

int n, p;
int a[N], tmp[N];
std::tr1::unordered_map<unsigned long long, int> map;

inline int main() {
  read(n), read(p);
  for (int i = 1; i <= n; ++i) a[i] = i;
  do {
    unsigned long long hash = 0;
    for (int l = 1; l <= n; ++l) {
      for (int r = l; r <= n; ++r) {
        for (int i = l; i <= r; ++i) tmp[i] = a[i];
        std::sort(tmp + l, tmp + r + 1);
        bool flag = true;
        for (int i = l; i < r; ++i)
          if (tmp[i] != tmp[i + 1] - 1) {
            flag = false;
            break;
          }
        hash = hash * base + flag + 1;
      }
    }
    ++map[hash];
  } while (std::next_permutation(a + 1, a + n + 1));
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("p.in", "r", stdin);
  freopen("p.out", "w", stdout);
#endif
#endif

  return BlueQuantum::main();
}